package com.ecommerce.service;

import com.ecommerce.entity.Banner;
import com.ecommerce.repository.BannerRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BannerService {
    
    @Autowired
    private BannerRepository bannerRepository;
    
    /**
     * 获取所有激活的轮播图
     */
    public List<Banner> getActiveBanners() {
        return bannerRepository.findActiveBannersOrderBySortOrder();
    }
    
    /**
     * 获取主轮播图
     */
    public List<Banner> getMainBanners() {
        return bannerRepository.findMainBanners();
    }
    
    /**
     * 获取前N个轮播图
     */
    public List<Banner> getTopBanners() {
        return bannerRepository.findTopBanners();
    }
} 